﻿using AutoMapper;
using CoreCms.Net.Model.ViewModels.Basics;

namespace CoreCms.Net.Mapping
{
    /// <summary>
    /// AutoMapper的全局实体映射配置静态类
    /// </summary>
    public class AutoMapperConfiguration : Profile
    {
        public AutoMapperConfiguration()
        {
            //CreateMap<Manager, ManagerDTO>().ReverseMap();

            CreateMap<SqlSugar.DbTableInfo, DbTableInfoTree>()
                .AfterMap((from, to, context) =>
                {
                    to.Label = from.Name + "[" + from.Description + "]";
                });

            ////商品分类转前端json
            //CreateMap<CoreCmsGoodsCategory, DTreeList>()
            //    .AfterMap((from, to, context) =>
            //    {
            //        to.id = from.id.ToString();
            //        to.title = from.name;
            //        to.checkArr = "0";
            //        to.parentId = from.parentId.ToString();
            //    });
        }
    }
}